#ifndef HASH_TABLE_H_
#define HASH_TABLE_H_

struct hash_table;

typedef unsigned int (*htab_hash_func_t)(void*, int);
typedef int (*htab_cmp_func_t)(void*, void*);

struct hash_table *htab_create(htab_hash_func_t hash, htab_cmp_func_t cmp);
void htab_free(struct hash_table *ht);

int htab_add(struct hash_table *ht, void *key, void *value);
int htab_del(struct hash_table *ht, void *key);

void *htab_get(struct hash_table *ht, void *key);


/* some common hash and compare functions */
unsigned int htab_hash_int(void *key, int sz);
int htab_cmp_int(void *a, void *b);

unsigned int htab_hash_string(void *key, int sz);
int htab_cmp_string(void *a, void *b);

#endif	/* HASH_TABLE_H_ */
